package fr.ensai.tp1.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang3.builder.ToStringBuilder;


@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
	    name="typeVehicule",
	    discriminatorType=DiscriminatorType.STRING)
public abstract class Vehicule implements Serializable{
	
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 5350266236562044533L;
	
	@Id
	@GeneratedValue
	private Long id;
	
	private String immatriculation;
	
	@ManyToOne(cascade=CascadeType.ALL)
	private Conducteur conducteur;
	
	@Temporal(value = TemporalType.DATE)
	private Date dateImmat;
	
	private String modele;
	
	
	
	
	
	
	public String toString(){
		return ToStringBuilder.reflectionToString(this);
	}
	
	public String getImmatriculation() {
		return immatriculation;
	}
	public void setImmatriculation(String immatriculation) {
		this.immatriculation = immatriculation;
	}
	public Date getDateImmat() {
		return dateImmat;
	}
	public void setDateImmat(Date dateImmat) {
		this.dateImmat = dateImmat;
	}
	public String getModele() {
		return modele;
	}
	public void setModele(String modele) {
		this.modele = modele;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Conducteur getConducteur() {
		return conducteur;
	}
	public void setConducteur(Conducteur conducteur) {
		this.conducteur = conducteur;
	}
	
	
	
}
